package pattern.singleton;

/**
 * Created by boot on 9/8/15.
 */
public class SingletonWithLock {
    private static SingletonWithLock instance;

    private SingletonWithLock() {

    }

    public static SingletonWithLock getInstance() {
        if (instance == null) {
            synchronized (SingletonWithLock.class) {
                if (instance == null) {
                    instance = new SingletonWithLock();
                }
            }
        }
        return instance;
    }
}
